package main

import (
	"fmt"
)


func main() {

	var s1 uint32 = 1
	var s2 uint32 = 1 << 1
	var s4 uint32 = 1 << 3
	var s8 uint32 = 1 << 7
	var s12 uint32 = 1 << 11
	var s16 uint32 = 1 << 16
	var s32 uint32 = 1 << 31

	fmt.Printf("s1:%v\n", s1)
	fmt.Printf("s2:%v\n", s2)
	fmt.Printf("s4:%v\n", s4)
	fmt.Printf("s8:%v\n", s8)
	fmt.Printf("s12:%v\n", s12)
	fmt.Printf("s16:%v\n", s16)
	fmt.Printf("s32:%v\n", s32)

	var value uint32 = s32 | s16 | s12 | s1
	var exist uint32 = s16 | s12 
	var notexist uint32 = s8 | s2

	fmt.Printf("value    :%b\n", value)
	fmt.Printf("xor value:%b\n", (^value))
	fmt.Printf("exist    :%b\n", exist)
	fmt.Printf("notexist :%b\n", notexist)

	if exist == (value & exist) {
		// "exist" değişkeninde set edilen bitler "value" değişkeninde de set edilmiştir.
		fmt.Println("exist match")
	} else {
		fmt.Println("exist not match")
	}
	

	if notexist == (^value & notexist) {
		// "notexist" değişkeninde set edilen bitler "value" değişkenin de set edilmemiştir.
		fmt.Println("notexist match")
	} else {
		fmt.Println("notexist not match")
	}
	
}
